// Decompiled by GOOSIN CO,LTD Copyright 2010 Pavel Kouznetsov.
// home page: http://www.Goosin.net
// Decompiler options: packimports(3) fieldsfirst ansi space 
// Source File Name:   excel_locate_getpara.java

package logistics.export;

import include.excel_export.Masking;
import include.excel_export.Solid;
import include.nseer_cookie.exchange;
import include.nseer_cookie.toUtf8String;
import java.io.IOException;
import java.util.StringTokenizer;
import javax.servlet.ServletException;
import javax.servlet.http.*;
import javax.servlet.jsp.JspFactory;

public class excel_locate_getpara extends HttpServlet
{

	public excel_locate_getpara()
	{
	}

	public synchronized void service(HttpServletRequest request, HttpServletResponse response)
		throws IOException, ServletException
	{
		HttpSession dbSession = request.getSession();
		JspFactory _jspxFactory = JspFactory.getDefaultFactory();
		javax.servlet.jsp.PageContext pageContext = _jspxFactory.getPageContext(this, request, response, "", true, 8192, true);
		javax.servlet.ServletContext dbApplication = dbSession.getServletContext();
		HttpSession session = request.getSession();
		Masking mask = new Masking("xml/logistics/data_excel.xml");
		Solid writer = new Solid("xml/logistics/excel_export.xml");
		try
		{
			String timea = request.getParameter("timea");
			String timeb = request.getParameter("timeb");
			String first_kind_name = "";
			String second_kind_name = "";
			String third_kind_name = "";
			first_kind_name = request.getParameter("select1");
			if (first_kind_name == null)
				first_kind_name = "";
			String select2 = request.getParameter("select2");
			if (select2 != null && !select2.equals(""))
			{
				for (StringTokenizer tokenTO1 = new StringTokenizer(select2, "/"); tokenTO1.hasMoreTokens();)
				{
					first_kind_name = tokenTO1.nextToken();
					second_kind_name = tokenTO1.nextToken();
				}

			}
			String select3 = request.getParameter("select3");
			if (select3 != null && !select3.equals(""))
			{
				for (StringTokenizer tokenTO2 = new StringTokenizer(select3, "/"); tokenTO2.hasMoreTokens();)
				{
					first_kind_name = tokenTO2.nextToken();
					second_kind_name = tokenTO2.nextToken();
					third_kind_name = tokenTO2.nextToken();
				}

			}
			String logisticser_ID = request.getParameter("logisticser_ID");
			String logistics_ID = request.getParameter("logistics_ID");
			String contact_ID = request.getParameter("contact_ID");
			String keyword = request.getParameter("keyword");
			if (timea == null)
				timea = "";
			if (timeb == null)
				timeb = "";
			if (logistics_ID == null)
				logistics_ID = "";
			if (contact_ID == null)
				contact_ID = "";
			if (keyword == null)
				keyword = "";
			String tablenick = request.getParameter("tablenick");
			session.setAttribute("table", tablenick);
			String tablename = mask.getTableNameFormNick(tablenick);
			String cols[] = request.getParameterValues("col");
			if (cols == null)
			{
				response.sendRedirect((new StringBuilder("logistics/export/excel_locate_getpara_a.jsp?tablenick=")).append(toUtf8String.utf8String(exchange.toURL(tablenick))).toString());
			} else
			{
				String colsName[] = new String[cols.length];
				for (int i = 0; i < cols.length; i++)
					colsName[i] = mask.getColumnName(tablenick, cols[i]);

				session.setAttribute("timea", timea);
				session.setAttribute("timeb", timeb);
				session.setAttribute("first_kind_name", first_kind_name);
				session.setAttribute("second_kind_name", second_kind_name);
				session.setAttribute("third_kind_name", third_kind_name);
				session.setAttribute("logisticser_ID", logisticser_ID);
				session.setAttribute("logistics_ID", logistics_ID);
				session.setAttribute("contact_ID", contact_ID);
				session.setAttribute("keyword", keyword);
				writer.update(tablename, tablenick, colsName, cols);
				response.sendRedirect("logistics_export_excel_ok");
			}
		}
		catch (Exception ex)
		{
			ex.printStackTrace();
		}
	}
}
